#ifndef _AD_CONSTRUCT_H_
#define _AD_CONSTRUCT_H_

#include "grate_constants.h"
#include "words_queue.h"
#include "dfa.h"
#include "input_data.h"
#include "grate_config.h"

// Main function, called to construct the AD using WORDS_QUEUE, and store AD in the trie DFA
// Returns the maximal number of symbols that were present in the queue at one moment
i64 construct_antidictionary(grate_config & CONFIG, input_data & INPUT, words_queue * WORDS_QUEUE, dfa * DFA);

// Hadles root stored in cword and adds forbidden word constructed from it if necessary
void handle_root(const char* cword, int clen, dfa * DFA, input_data & INPUT);

// Checks if a root has no forbidden suffix
const bool forbidden_root(const char* cword, int clen, dfa * DFA, input_data & INPUT);

// Checks if root in cword has form WW
const bool is_square(const char* cword, int clen);

#endif